<!DOCTYPE html>
<html>
<head>
    <title>企业黑名单管理</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/weui.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/jquery-weui.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/commod.css">


</head>

<body ontouchstart>
<div class="man_centent" id="mainCentent">
    <div class="weui-search-bar" id="searchBar">
        <div class="weui-search-bar__form">
            <div class="weui-search-bar__box">
                <i class="weui-icon-search"></i>
                <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
                <a class="weui-icon-clear" id="searchClear"></a>
            </div>
            <label class="weui-search-bar__label" id="searchText">
                <i class="weui-icon-search"></i>
                <span>搜索</span>
            </label>
        </div>
        <a class="weui-search-bar__cancel-btn" id="searchCancel" v-on:click="searchInfo">确定</a>
    </div>
    <div class="weui-panel__bd" v-for="item in datalist">
        <a class="weui-media-box weui-media-box_appmsg" v-on:click="clickInfo(item)">
            <div class="weui-media-box__hd">
                <img class="weui-media-box__thumb" src="${request.contextPath}/statics/img/avatar.jpg"
                     alt="">
            </div>
            <div class="weui-media-box__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">姓名</label>
                    <span class="weui-form-preview__value">{{item.name}}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">职务</label>
                    <span class="weui-form-preview__value">{{item.job}}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">开除原因</label>
                    <span class="weui-form-preview__value">{{item.reason}}</span>
                </div>

            </div>
        </a>
    </div>
</div>
<script src="${request.contextPath}/statics/libs/jquery-2.1.4.js"></script>
<script src="${request.contextPath}/statics/libs/fastclick.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });
</script>
<script src="${request.contextPath}/statics/libs/jquery-weui.js"></script>
<script>
    var mainCentent = new Vue({
        el: '#mainCentent',
        data: {
            datalist: null
        },
        methods: {
            searchInfo: function () {
                var v = $('#searchInput').val();
                mainCentent.searchList(v);
            },
            searchList: function (text) {
                var url = "127.0.0.1:8080/wechat/getUserList?name=" + text.toString();
                console.log(url);
                $.showLoading();
                $.ajax({
                    type: "GET",
                    url: "/wechat/getUserList?name=" + text.toString(),
                    dataType: "json",
                    success: function (result) {
                        $.hideLoading();
                        console.log(result)
                        if (result.code === 0) {
                            mainCentent.datalist = result.data;
                        } else {
                            $.toast(result.msg, "cancel", function (toast) {
                                console.log(toast);
                            });
                        }
                    },
                    fail: function (err) {
                        $.hideLoading();
                        console.log(err)
                    }
                });
            },
            clickInfo:function (item) {
                localStorage.employeeData = JSON.stringify(item);
                window.location.href='info_des.html';
            }
        }
    });
    $('#searchInput').keydown(function (e) {
        if (e.keyCode === 13) {
            e.preventDefault();
            var v = $('#searchInput').val();
          mainCentent.searchList(v)
        }
    });
</script>
</body>
</html>
